package July;

import java.util.HashMap;
import java.util.Scanner;

public class Day0721 {
    //最大连续bit数
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        //十进制转二进制
        String s =Integer.toString(n,2);
        int max = 0;
        int count = 0;
        //统计最大连续bit数
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == '1'){
                count = count+1;
            } else if (s.charAt(i) == '0') {
                if (max < count)
                    max = count;
                count = 0;
            }
        }
        System.out.println(max);
    }


    /**
     * 最近公共祖先
     */
//    public int getLCA(int a, int b) {
//
//    }

}
